
package com.hc.controller;

import java.util.List;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import com.hc.domain.Role;
import com.hc.service.IRoleService;

@Controller
@RequestMapping("View")
public class ViewController {
	@Resource
	private IRoleService roleService;
	
	@RequestMapping(value = "/web/{path}")
	@ResponseBody
	public ModelAndView web(HttpServletRequest req, HttpServletResponse resp, @PathVariable String path,
			ModelMap modelMap) {
		if (path.equals("role")){
			List<Role> list = roleService.findAll();
			modelMap.addAttribute("role", list);
		}
		return new ModelAndView(path, modelMap);
	}
}

